class Person{
    //属性
    //功能
    public String name;//名字
    public int age;//年龄
    public void eat() {
        System.out.println(name+"吃饭");
    }
    public void sleep() {
        System.out.println(name+"睡觉");
    }
    public void play(String a) {
        System.out.println(name+a);
    }
}
class Person1{
    //属性
    //功能
    public String name="武毅";//名字
    public int age;//年龄
    public void eat() {
        System.out.println(name+"吃饭");
    }
    public void sleep() {
        System.out.println(name+"睡觉");
    }
    public void play(String a) {
        System.out.println(name+a);
    }
}

public class Test {

    public static void main4(String[] args) {

    }
    public static void main3(String[] args) {
        Person1 person1=new Person1();
          person1.name="张三";
        System.out.println(person1.name);
        Person person2=new Person();
        person2.name="张妍书";
        System.out.println(person2.name);
    }
    public static void main2(String[] args) {
        Person person1=new Person();
        person1.name="武毅";
        person1.age=18;
        person1.play("打王荣荣耀");
        System.out.println(person1.name+" "+person1.age);
    }
    public static void main1(String[] args) {
        Person person1=new Person();//一个类可以实例化多个对象，通过关键字new
        person1.name="武毅";
        person1.age=20;
        person1.eat();
        person1.sleep();
        Person person2=new Person();
        person2.name="张妍书";
        person2.age=18;
        person2.eat();
        person2.sleep();
        Person person3=new Person();
        person3.name="小明";
        person3.age=18;
        person3.eat();
        person3.sleep();
    }
}
